package com.letoken.platform.pub.util;

import com.alibaba.fastjson.JSONArray;

import java.util.HashMap;
import java.util.Map;

public class SMSUtil {
        private static String url="http://smsapi.weiqucloud.com/sms/httpSmsInterface2";
        private static String areaUrl="http://api2.nxcloud.com/api/sms/mtsend";
        private static String userId="zhongxiangzuji";
        private static String account="API123123";
        private static String password="888999";

        private static String template = "【乐商】您的验证码123，5分钟内有效，如非本人操作，请忽略或联系客服。 ";


        private static String areaTemplate = "【Letoken】 Your account is applying for verification, the verification code is %s, please do not disclose it if it is not operated by yourself!";




        public static String sendSMS(String mobile,String content) throws Exception {
                Map<String,String> map = new HashMap();
                map.put("userId","zhongxiangzuji");
                map.put("account","bythe");
                map.put("password","123456");
                map.put("mobile","18516571226");
                map.put("content","【BY THE】您的验证码1234");
                map.put("sendTime","");
                map.put("action","sendhy");
                map.put("custom","");
                map.put("callbackUrl","");
                Object obj = JSONArray.toJSON(map);
                String json = obj.toString();
                String req = HttpClientUtil.sendPostJson(url,json,null);
                return req;
        }


        public static String internationalitySendSMS(Integer number,String mobile,String content) throws Exception {
                Map<String,String> map = new HashMap();
                map.put("appkey","ABiOjQkH");
                map.put("secretkey","tnI9mFUS");
                map.put("phone",number+mobile);
                map.put("content",String.format(areaTemplate,content));
                String req = HttpClientUtil.sendPostForm(areaUrl,map,null);
                return req;
        }

        public static void main(String[] args) throws Exception {
                System.out.println(SMSUtil.sendSMS("19073115391",null));
        }
}
